package online.acutuator.endpoint;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.actuate.endpoint.annotation.Endpoint;
import org.springframework.boot.actuate.endpoint.annotation.ReadOperation;
import org.springframework.boot.actuate.endpoint.annotation.WriteOperation;
import org.springframework.stereotype.Component;

import java.util.Collections;
import java.util.Map;

/**
 * @Auther: 狼芒
 * @Date: 2021/9/15 22:57
 * @Descrintion: 自定义监控页面
 * @version: 1.0
 */
@Slf4j
@Component
@Endpoint(id = "container")
public class DockerEndpoint {

    @ReadOperation
    public Map getDockerInfo() {
        //断点的读操作
        return Collections.singletonMap("info", "docker started...");
    }

    @WriteOperation
    private void restartDocker() {
        log.info("docker restarted...");
    }
}
